package com.kaili.basic.service.impl;

import com.kaili.basic.pojo.entity.BaseDict;
import com.kaili.basic.mapper.BaseDictMapper;
import com.kaili.basic.service.IBaseDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  数据字典服务实现类
 * </p>
 *
 * @author nigang
 * @since 2018-05-04
 */
@Service
@Transactional
public class BaseDictServiceImpl implements IBaseDictService {

    @Autowired
    BaseDictMapper baseDictMapper;

    @Override
    public Integer getMaxDictId() {
        return baseDictMapper.getMaxDictId();
    }

    @Override
    public Integer getMaxDictTypeOrder() {
        return baseDictMapper.getMaxDictTypeOrder();
    }

    @Override
    public Integer getMaxDictOrder(Integer dictId) {
        return baseDictMapper.getMaxDictOrder(dictId);
    }

    @Override
    public List<BaseDict> getDictByParentName(String dictName) {
        return baseDictMapper.getDictByParentName(dictName);
    }

    @Override
    public List<BaseDict> getAllDictType() {
        return baseDictMapper.getAllDictType();
    }

    @Override
    public BaseDict getDictById(Integer dictId) {
        return baseDictMapper.getDictById(dictId);
    }

    @Override
    public List<BaseDict> getDictByCode(BaseDict dict) {
        return baseDictMapper.getDictByCode(dict);
    }

    @Override
    public List<BaseDict> getDictByName(BaseDict dict) {
        return baseDictMapper.getDictByName(dict);
    }

    @Override
    public List<BaseDict> getDictByIdCode(BaseDict dict) {
        return baseDictMapper.getDictByIdCode(dict);
    }

    @Override
    public List<BaseDict> getDictByIdName(BaseDict dict) {
        return baseDictMapper.getDictByIdName(dict);
    }

    @Override
    public List<BaseDict> getDictByParentId(Integer parentId) {
        return baseDictMapper.getDictByParentId(parentId);
    }

    @Override
    public List<BaseDict> getDictByDictId(Integer parentId) {
        return baseDictMapper.getDictByDictId(parentId);
    }

    @Override
    public List<BaseDict> getDictByDictId2(Integer parentId) {
        return baseDictMapper.getDictByDictId2(parentId);
    }

    @Override
    public int updateDict(BaseDict dict) {
        return baseDictMapper.updateDict(dict);
    }

    @Override
    public int addDict(BaseDict dict) {
        return baseDictMapper.addDict(dict);
    }

    @Override
    public int deleteDictById(Integer dictId) {
        int reult1=baseDictMapper.deleteDictById(dictId);
        int reult2=baseDictMapper.deleteDictByParentId(dictId);
        return reult1;
    }

    @Override
    public int deleteDictByParentId(Integer parentId) {
        return baseDictMapper.deleteDictByParentId(parentId);
    }

    @Override
    public BaseDict selectByDictName(String dictName) {
        return baseDictMapper.selectByDictName(dictName);
    }
}
